package com.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bean.User;
import com.dao.UserDao;
import com.service.IUserService;

@Transactional
@Service
//@EnableConfigurationProperties(User.class)
public class UserServiceImpl implements IUserService {
    @Autowired
    private UserDao userDao;
    @Value("${name}")
    private String userName;
    @Value("${my.number.in.range}")
    private int random;
    @Autowired
    private Environment env;
    @Autowired
    private User user;

    public User getUserById(Long uid) {
        userDao.update(uid, "lisi" + uid.longValue());
        System.out.println(userName);
        System.out.println(env.getProperty("name"));
        System.out.println(random);
        System.out.println(user.getName());
        return userDao.getUserById(uid);
    }

}
